package com.example.myapplication.adp;

import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.myapplication.R;
import com.example.myapplication.database.GetComment;
import com.example.myapplication.database.User;
import com.example.myapplication.util.GlideUtil;

import org.litepal.LitePal;

import java.util.List;

public class GetCommentAdp extends BaseQuickAdapter<GetComment, BaseViewHolder> {
    public GetCommentAdp( @Nullable List<GetComment> data) {
        super(R.layout.get_detail_comment_item, data);

    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, GetComment getComment) {
        User user = LitePal.find(User.class, getComment.getUserId());
        ImageView itemIcon = baseViewHolder.getView(R.id.itemIcon);
        GlideUtil.loadHead(user.getAva(),itemIcon);
        baseViewHolder.setText(R.id.itemName,user.getName());
        baseViewHolder.setText(R.id.itemDes,getComment.getDes());
        baseViewHolder.setText(R.id.itemPrice,"￥"+getComment.getPrice());
        baseViewHolder.setText(R.id.itemTime,getComment.getTime());

    }
}
